home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 424_01 / ed_157 / show_param.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-11  |  3.6 KB  |  147 lines

  1. /*
  2.  * Copyright (C) 1992 by Rush Record (rhr@clio.rice.edu)
  3.  * 
  4.  * This file is part of ED.
  5.  * 
  6.  * ED is free software; you can redistribute it and/or modify it under the terms
  7.  * of the GNU General Public License as published by the Free Software Foundation.
  8.  * 
  9.  * ED is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  10.  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  11.  * PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  12.  * 
  13.  * You should have received a copy of the GNU General Public License along with ED
  14.  * (see the file COPYING).  If not, write to the Free Software Foundation, 675
  15.  * Mass Ave, Cambridge, MA 02139, USA.
  16.  */
  17. #include "opsys.h"
  18.  
  19. #include <stdio.h>
  20. #include <string.h>
  21.  
  22. #include "rec.h"
  23. #include "window.h"
  24. #include "ed_dec.h"
  25. #include "cmd_enum.h"
  26. #include "cmd_dec.h"
  27.  
  28. extern Char *version();
  29.  
  30. /******************************************************************************\
  31. |Routine: show_param
  32. |Callby: command
  33. |Purpose: Handles the display of editor settings.
  34. |Arguments:
  35. |    choice is the number of the setting to display, or -1 to display all settings.
  36. \******************************************************************************/
  37. void show_param(choice)
  38. Int choice;
  39. {
  40.     Int start,l,i;
  41.     Int record,byte;
  42.     Char buf[256],save_hexmode,*ebuf;
  43.  
  44.     save_hexmode = HEXMODE;
  45.     HEXMODE = 0;
  46.     if(choice < 0)
  47.     {
  48.         start = 0;
  49.         choice = (int)NUM_PARAMS - 2;    /* don't do SHOW KEYS */
  50.     }
  51.     else
  52.         start = choice;
  53.     for(;start <= choice;start++)
  54.     {
  55.         strcpy(buf,prompts[start]);
  56.         strcat(buf,": ");
  57.         l = strlen(buf);
  58.         switch(start)
  59.         {
  60.         case PAR_SHELL:
  61.             strcat(buf,USERSHELL);
  62.             break;
  63.         case PAR_TABS:
  64.             strcat(buf,TAB_NAME[CUR_TAB_SETUP]);
  65.             break;
  66.         case PAR_WRAP:
  67.             sprintf(buf + l,"%d",WRAP_MARGIN);
  68.             break;
  69.         case PAR_SECTION:
  70.             sprintf(buf + l,"%d",SECTION_LINES);
  71.             break;
  72.         case PAR_WORD:
  73.             express(NWORD_DELIMITERS,WORD_DELIMITERS,0,0,&ebuf,256 - l,1);
  74.             strcpy(buf + l,ebuf);
  75.             break;
  76.         case PAR_PAGE:
  77.             express(PAGE_BREAK_LENGTH,PAGE_BREAK,0,0,&ebuf,256 - l,1);
  78.             strcpy(buf + l,ebuf);
  79.             break;
  80.         case PAR_PARAGRAPH:
  81.             express(PARAGRAPH_BREAK_LENGTH,PARAGRAPH_BREAK,0,0,&ebuf,256 - l,1);
  82.             strcpy(buf + l,ebuf);
  83.             break;
  84.         case PAR_SEARCH:
  85.             for(i = 0;i < NUM_SMODES;i += 2)
  86.             {
  87.                 strcat(buf,"<");
  88.                 strcat(buf,sprompts[(SEARCH_FLAGS[i >> 1] == *smodes[i])? i : i+1]);
  89.                 strcat(buf,"> ");
  90.             }
  91.             break;
  92.         case PAR_STABLE:
  93.             strcat(buf,SEARCH_TABLE);
  94.             break;
  95.         case PAR_CLOSE_PARENS:
  96.             strcat(buf,offon[(CLOSE_PARENS)? 1 : 0]);
  97.             break;
  98.         case PAR_PARENS:
  99.             strcat(buf,PAREN_STRING);
  100.             break;
  101.         case PAR_DEFAULT:
  102.             strcat(buf,DEFAULT_EXT);
  103.             break;
  104.         case PAR_AUTO_TABS:
  105.             strcat(buf,offon[(TAB_AUTO)? 1 : 0]);
  106.             break;
  107.         case PAR_CFRIENDLY:
  108.             strcat(buf,offon[(CFRIENDLY)? 1 : 0]);
  109.             break;
  110.         case PAR_BOXCUT:
  111.             strcat(buf,offon[(BOXCUT)? 1 : 0]);
  112.             break;
  113.         case PAR_AUTOWRAP:
  114.             strcat(buf,offon[(AUTOWRAP)? 1 : 0]);
  115.             break;
  116.         case PAR_CASE:
  117.             strcat(buf,caseprompts[CASECHANGE]);
  118.             break;
  119.         case PAR_OVERSTRIKE:
  120.             strcat(buf,offon[(OVERSTRIKE)? 1 : 0]);
  121.             break;
  122.         case PAR_GREPMODE:
  123.             strcat(buf,grepmodes[(int)GREPMODE]);
  124.             break;
  125.         case PAR_WILDCARD:
  126.             buf[strlen(buf) + 1] = '\0';
  127.             buf[strlen(buf)] = WILDCARD;
  128.             break;
  129.         case PAR_POSITION:
  130.             get_position(&record,&byte);
  131.             sprintf(buf + l,"Record: %d, Byte: %d, Row: %d, Column: %d",record,byte,CURROW,CURCOL);
  132.             break;
  133.         case PAR_MODIFIED:
  134.             strcat(buf,(WINDOW[CURWINDOW].modified)? "Yes" : "No");
  135.             break;
  136.         case PAR_VERSION:
  137.             sprintf(buf + l,"%s",version());
  138.             break;
  139.         }
  140.         slip_message(buf);
  141.     }
  142.     wait_message();
  143.     paint(BOTROW,BOTROW,FIRSTCOL);
  144.     HEXMODE = save_hexmode;
  145. }
  146.  
  147.